<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计算数组中出现元素的次数</title>
	</head>
	<body>
		<h4>题目描述</h4>
		<p>统计数组 arr 中值等于 item 的元素出现的次数</p>
		<span>count([1, 2, 4, 4, 3, 4, 3], 4)</span>
		<script>
			function count (a,i) {
				var arr = a;
				var item = i;
				var timer = arr.filter( (i) => {return i == item;} ).length;
				console.log(timer);
			}

			count([1, 2, 4, 4, 3, 4, 3], 4);
		</script>
	</body>
</html>
